package com.hoshiicloud.mallshop.feign.hystrix;

import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.mallshop.feign.ShopPayMentFeignService;
import com.hoshiicloud.payment.Paylist;
import com.hoshiicloud.payment.param.RefundRequest;
import com.hoshiicloud.payment.vo.RefundResponse;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * 2019/8/27 18:21 qry
 */
@Slf4j
public class ShopPayMentFeignServiceFallback implements FallbackFactory<ShopPayMentFeignService> {
    @Override
    @HystrixCommand
    public ShopPayMentFeignService create(Throwable throwable) {
        return new ShopPayMentFeignService() {

            @Override
            public Response<RefundResponse> refundOrder(RefundRequest refundRequest) {
                return Response.failed("退款失败"+ throwable.getMessage());
            }

            @Override
            public Response<Paylist> getPaylistByPayOrderId(String payOrderId) {
                return Response.failed("获取支付流水失败"+ throwable.getMessage());
            }


        };
    }
}
